﻿// ===============================================================================
// XCI.NET 西安交通信息WinForm开发框架 2018 版权所有
// ===============================================================================
using System.ComponentModel;
using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Controls;
using DevExpress.XtraGrid;
using DevExpress.XtraGrid.Columns;
using DevExpress.XtraGrid.Views.Grid;
using XCI.Windows.Controls;

namespace XCI.Windows.Plugin.GridSetting.UI
{
    [ToolboxItem(false)]
    public partial class GridExpression : BaseGridExpression
    {
        public GridExpression()
        {
            InitializeComponent();
        }

        private GridSettingPlugin Plugin { get; set; }

        public void Initialize(GridSettingPlugin uiplugin)
        {
            this.Plugin = uiplugin;
            base.MainGrid.MenuManager = Plugin.View.GridControl.MenuManager;
            base.Initialize();
        }

        protected override FormatConditionCollectionBase GetFormats()
        {
            return Plugin.View.FormatConditions;
        }

        protected override GridColumnCollection GetGridColumns()
        {
            return Plugin.View.Columns;
        }

        protected override StyleFormatConditionBase NewCondition()
        {
            var condition = new StyleFormatCondition();
            condition.Condition =FormatConditionEnum.Expression;
            Plugin.View.FormatConditions.Add(condition);
            return condition;
        }
    }
}
